package com.geek.factory.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.geek.factory.entity.InventoryDistribution;
import com.geek.factory.mapper.InventoryDistributionMapper;
import com.geek.factory.service.IInventoryDistributionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * <p>
 * 库存分布表 服务实现类
 * </p>
 *
 * @author author
 * @since 2025-06-27
 */
@Service
public class InventoryDistributionServiceImpl extends ServiceImpl<InventoryDistributionMapper, InventoryDistribution> implements IInventoryDistributionService {
    @Autowired
    private InventoryDistributionMapper inventoryDistributionMapper;

    @Override
    public BigDecimal getTotalStockByProductId(Integer productId) {
        return inventoryDistributionMapper.sumQuantityByProductId(productId);
    }

    @Override
    public BigDecimal getTotalStockByMaterialId(Integer materialId) {
        return inventoryDistributionMapper.sumQuantityByMaterialId(materialId);
    }
}
